<?php

// $GLOBALS['test']
 
function getTest($val){
	
	if($val )
		$GLOBALS['test'] = $val ;
	return $GLOBALS['test'];
}

class StaticTest {
	static  $instance = null ;

	function __construct(){
 		self::$instance = $this;
    }

	static public function getInstance()
	{
		return self::$instance;
	}  

};


print("before ......<br/>");


$it = getTest();

print("get instance  " . ( $it ? "not null" : "null") .  ".....<br/>");
var_dump($it);


if(!$it)
 	{
 		$it = getTest("aaaaaaaa");
		print("new instance  " . ( $it ? "not null" : "null") .  ".....<br/>"); 		
		var_dump($it);
 	}else{

 	}


 
?>
